//
//  HSHW_htViewModel.swift
//  HomeSchoolDemo
//
//  Created by rimi on 2016/10/13.
//  Copyright © 2016年 黄华强. All rights reserved.
//

import UIKit

class HSHW_htViewModel {

    var details: HSHW_htModel {
        didSet {
            
        }
    }
    
    var titleH: CGFloat = 50
    
    var cellHeight: CGFloat = 300
    
    var contentViewH: CGFloat = 100
    
    init(model:HSHW_htModel) {
        details = model
        let a = details.ht_type 
        switch a {
        case 1:
            print("1111")
            contentViewH = 100
        case 2:
            print("2222")
            contentViewH = 100
        case 3:
            print("3333")
            contentViewH = 50
        case 4:
            print("4444")
            contentViewH = 200
        default:
            break
        }
        let maxSize = CGSize(width: screenW * 0.85 - 8, height: CGFloat(MAXFLOAT))
        titleH = ((details.ht_title ?? "") as NSString).boundingRect(with: maxSize, options: NSStringDrawingOptions.usesLineFragmentOrigin, attributes: [NSFontAttributeName:UIFont.systemFont(ofSize: 15)], context: nil).size.height
        cellHeight = contentViewH + titleH + 24
    }
}
